/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import model.dao.util.MySqlDataAccessHelper;
import model.pojo.FilterCurrentCpu;

/**
 *
 * @author TiOc
 */
public class FilterCurrentCpuDAO 
{
    public static ArrayList<FilterCurrentCpu> getFilterCurrentCpu()
    {
        ArrayList<FilterCurrentCpu> ds = new ArrayList<FilterCurrentCpu>();
        String sql = "SELECT * FROM FilterCurrentCpu As fc WHERE fc.isPublish = '1' ORDER BY fc.nameCurrentCpu";
        MySqlDataAccessHelper helper = new MySqlDataAccessHelper();
        helper.open();
        ResultSet rs = helper.executeQuery(sql); 
        try
        {
            while(rs.next())
            {
                FilterCurrentCpu fc = new FilterCurrentCpu();
                fc.setIdFilterCurrentCpu(rs.getInt("idFilterCurrentCpu"));
                fc.setNameCurrentCpu(rs.getString("nameCurrentCpu"));
                fc.setIsPublish(rs.getInt("isPublish"));
                ds.add(fc);
            }
        }
        catch(SQLException ex)
        {
            System.out.println(ex.getMessage());
        }
        helper.close();
        
        return ds;
    }
}
